/**
 * jpa 高级查询实现
 *
 * @author lgq
 * @date 2018/4/15
 **/
package com.example.demo.repository;

import org.springframework.data.jpa.domain.Specification;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

/**
 * JPA 高级查询
 *
 * @param <ENTITY> 实体
 * @param <DTO>    数据传输实体
 * @author yexi
 */
public class JpaSpec<ENTITY, DTO> implements Specification<ENTITY> {
    private DTO dto;

    public JpaSpec(DTO dto) {
        this.dto = dto;
    }

    @Override
    public Specification<ENTITY> and(Specification<ENTITY> other) {
        return null;
    }

    @Override
    public Specification<ENTITY> or(Specification<ENTITY> other) {
        return null;
    }

    @Override
    public Predicate toPredicate(Root<ENTITY> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
        return null;
    }
}
